package com.project.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页实体类
 * @param <T> 查询的内容
 */
public class CutPageBean<T> {

    /**
     * 当前页面需要显示的内容
     */
    private List<T> list = new ArrayList<>();
    /**
     * 总记录数
     */
    private int count;
    /**
     * 总页数（提供超链接个数）
     */
    private int pageSize;
    /**
     * 每页显示记录数
     */
    public static int PAGENUM = 4;

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
        this.pageSize = count%PAGENUM == 0?count/PAGENUM : count/PAGENUM+1;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    @Override
    public String toString() {
        return "CutPageBean{" +
                "list=" + list +
                ", count=" + count +
                ", pageSize=" + pageSize +
                "}\n";
    }
}
